package it.hopeless.jee6.injection;

import it.hopeless.jee6.security.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.inject.Inject;
import javax.inject.Named;

/**
 * User: frico
 * Date: Feb 13, 2010
 * Time: 7:55:11 PM
 */
@Named
public class DocumentEditor {
    private static final Logger logger = LoggerFactory.getLogger(DocumentEditor.class);
    @Inject private Document document;
    @Inject @LoggedIn private User currentUser;

    public void save() {
        logger.debug("Document: "+ document+ " created by: "+ currentUser);
        document.setCreatedBy(currentUser);
    }

}